﻿<Page x:Class="LanguageSelectionPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:l="http://wpfglue.wordpress.com/localization"
    xmlns:ex="clr-namespace:LocalizedResourcesExample"
    xmlns:r="clr-namespace:LocalizedResourceAssembly;assembly=LocalizedResourceAssembly"
    Title="LanguageSelectionPage" FlowDirection="{l:FlowDirection}">
    <Page.Resources>
        <l:LocalizedList x:Key="languageList" Definition="{l:String LanguageList}"/>
        <l:LocalizedList x:Key="assemblies">
            <l:Entry Key="{l:String InternalLabel}" Value="{x:Null}"/>
            <l:Entry Key="{l:String ExternalLabel}" Value="{x:Type r:Dummy}"/>
        </l:LocalizedList>
    </Page.Resources>
    <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
        <StackPanel Orientation="Horizontal"><Label Content="{l:String SelectLanguageLabel}"/>
            <ComboBox SelectedValue="{Binding RelativeSource={RelativeSource Mode=FindAncestor,
                AncestorType={x:Type NavigationWindow}}, Path=(l:Localization.UILanguage)}"
                ItemsSource="{StaticResource languageList}"
                SelectedValuePath="Value"/>
            </StackPanel>
        <ComboBox x:Name="SelectAssembly" ItemsSource="{StaticResource assemblies}" DisplayMemberPath="Key" SelectedValuePath="Value"
                      SelectedValue="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type NavigationWindow}}, Path=(l:Localization.ResourceReferenceType)}"/>
        <TextBlock>
            <Hyperlink NavigateUri="LocalizedPage.xaml"><Run Text="{l:String GotoLocalizedPageLabel}"/></Hyperlink>
        </TextBlock>
        <TextBlock Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,
                AncestorType={x:Type NavigationWindow}}, Path=(l:Localization.UILanguage), Converter={StaticResource languageList}}"/>
    </StackPanel>
</Page>
